package org.tloss.cluster;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.Principal;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class HttpServletRequestWrapper implements HttpServletRequest {
	private HttpServletRequest orig;
	private HttpServletResponse response;

	public HttpServletRequestWrapper(HttpServletRequest request,
			HttpServletResponse response) {
		orig = request;
		this.response = response;
	}

	public Object getAttribute(String arg0) {

		return orig.getAttribute(arg0);
	}

	public Enumeration getAttributeNames() {

		return orig.getAttributeNames();
	}

	public String getCharacterEncoding() {

		return orig.getCharacterEncoding();
	}

	public int getContentLength() {

		return orig.getContentLength();
	}

	public String getContentType() {

		return orig.getContentType();
	}

	public ServletInputStream getInputStream() throws IOException {

		return orig.getInputStream();
	}

	public String getLocalAddr() {

		return orig.getLocalAddr();
	}

	public String getLocalName() {

		return orig.getLocalName();
	}

	public int getLocalPort() {

		return orig.getLocalPort();
	}

	public Locale getLocale() {

		return orig.getLocale();
	}

	public Enumeration getLocales() {

		return orig.getLocales();
	}

	public String getParameter(String arg0) {

		return orig.getParameter(arg0);
	}

	public Map getParameterMap() {

		return orig.getParameterMap();
	}

	public Enumeration getParameterNames() {

		return orig.getParameterNames();
	}

	public String[] getParameterValues(String arg0) {

		return orig.getParameterValues(arg0);
	}

	public String getProtocol() {

		return orig.getProtocol();
	}

	public BufferedReader getReader() throws IOException {

		return orig.getReader();
	}

	public String getRealPath(String arg0) {

		return orig.getRealPath(arg0);
	}

	public String getRemoteAddr() {

		return orig.getRemoteAddr();
	}

	public String getRemoteHost() {

		return orig.getRemoteHost();
	}

	public int getRemotePort() {

		return orig.getRemotePort();
	}

	public RequestDispatcher getRequestDispatcher(String arg0) {

		return orig.getRequestDispatcher(arg0);
	}

	public String getScheme() {

		return orig.getScheme();
	}

	public String getServerName() {

		return orig.getServerName();
	}

	public int getServerPort() {

		return orig.getServerPort();
	}

	public boolean isSecure() {

		return orig.isSecure();
	}

	public void removeAttribute(String arg0) {
		orig.removeAttribute(arg0);

	}

	public void setAttribute(String arg0, Object arg1) {
		orig.setAttribute(arg0, arg1);

	}

	public void setCharacterEncoding(String arg0)
			throws UnsupportedEncodingException {
		orig.setCharacterEncoding(arg0);

	}

	public String getAuthType() {

		return orig.getAuthType();
	}

	public String getContextPath() {

		return orig.getContextPath();
	}

	public Cookie[] getCookies() {

		return orig.getCookies();
	}

	public long getDateHeader(String arg0) {

		return orig.getDateHeader(arg0);
	}

	public String getHeader(String arg0) {

		return orig.getHeader(arg0);
	}

	public Enumeration getHeaderNames() {

		return orig.getHeaderNames();
	}

	public Enumeration getHeaders(String arg0) {

		return orig.getHeaders(arg0);
	}

	public int getIntHeader(String arg0) {

		return orig.getIntHeader(arg0);
	}

	public String getMethod() {

		return orig.getMethod();
	}

	public String getPathInfo() {

		return orig.getPathInfo();
	}

	public String getPathTranslated() {

		return orig.getPathTranslated();
	}

	public String getQueryString() {

		return orig.getQueryString();
	}

	public String getRemoteUser() {

		return orig.getRemoteUser();
	}

	public String getRequestURI() {

		return orig.getRequestURI();
	}

	public StringBuffer getRequestURL() {

		return orig.getRequestURL();
	}

	public String getRequestedSessionId() {

		return orig.getRequestedSessionId();
	}

	public String getServletPath() {

		return orig.getServletPath();
	}

	public HttpSession getSession() {

		HttpSession httpSession = orig.getSession();
		if (httpSession != null) {
			return new HttpSessionWrapper(httpSession, orig,response);
		}
		return null;
	}

	public HttpSession getSession(boolean arg0) {

		HttpSession httpSession = orig.getSession(arg0);
		if (httpSession != null) {
			return new HttpSessionWrapper(httpSession, orig,response);
		}
		return null;
	}

	public Principal getUserPrincipal() {

		return orig.getUserPrincipal();
	}

	public boolean isRequestedSessionIdFromCookie() {

		return orig.isRequestedSessionIdFromCookie();
	}

	public boolean isRequestedSessionIdFromURL() {

		return orig.isRequestedSessionIdFromURL();
	}

	public boolean isRequestedSessionIdFromUrl() {

		return orig.isRequestedSessionIdFromUrl();
	}

	public boolean isRequestedSessionIdValid() {

		return orig.isRequestedSessionIdValid();
	}

	public boolean isUserInRole(String arg0) {

		return orig.isUserInRole(arg0);
	}

}
